import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { MsgManager } from "../../../manager/MsgManager";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GTextInput } from "../../../../../com/mui/controls/GTextInput";
type int = number;
//class MultiTakeOutMoneyWindow
    
    export  class MultiTakeOutMoneyWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            titleHeight = 30;
            this.setSize(260, 230);
            this.title = Language.getString(27964);
            this.init();
            return;
        }

        /* internal  */onMoneyChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            this._expendGold.text = String(int(this._goldInput.text) * this._memberSum);
            return;
        }

        /* internal  */onCoinChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            this._expendCoin.text = String(int(this._coinInput.text) * this._memberSum);
            return;
        }

        /* internal  */get expendGold(): int
        {
            return int(this._goldInput.text) * this._memberSum;
        }

        /* internal  */get expendCoin(): int
        {
            return int(this._coinInput.text) * this._memberSum;
        }

        /* internal  */onOkBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._memberSum < 1) 
            {
                MsgManager.showRollTipsMsg(Language.getString(27974));
                return;
            }
            if (this.storageGold < this.expendGold) 
            {
                MsgManager.showRollTipsMsg(Language.getString(27957));
                return;
            }
            if (this.storageCoin < this.expendCoin) 
            {
                MsgManager.showRollTipsMsg(Language.getString(27958));
                return;
            }
            this._responFun(this.goldInput, 0);
            this._responFun(0, this.coinInput);
            this.hide();
            return;
        }

        /* internal  */get goldInput(): int
        {
            if (this._goldInput.text == "") 
            {
                return 0;
            }
            return int(this._goldInput.text);
        }

        /* internal  */get coinInput(): int
        {
            if (this._coinInput.text == "") 
            {
                return 0;
            }
            return int(this._coinInput.text);
        }

        public set memberSum(arg1: int)
        {
            this._memberSum = arg1;
            this._memberMumText.htmlText = Language.getStringByParam(27962, arg1);
            return;
        }

        public set responFun(arg1: Function)
        {
            this._responFun = arg1;
            return;
        }

        public set storageGold(arg1: int)
        {
            this._storageGold.text = arg1.toString();
            return;
        }

        public get storageGold(): int
        {
            return int(this._storageGold.text);
        }

        public set storageCoin(arg1: int)
        {
            this._storageCoin.text = arg1.toString();
            return;
        }

        public get storageCoin(): int
        {
            return int(this._storageCoin.text);
        }

        public /* override */ hide(): void
        {
            super.hide();
            this._goldInput.text = "0";
            this._coinInput.text = "0";
            this._expendGold.text = "0";
            this._expendCoin.text = "0";
            this._memberMumText.htmlText = Language.getStringByParam(27962, 0);
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ObjCreate.createBg(20, 43, 220, 173, this);
            var loc2=ObjCreate.createGTextField(Language.getString(27971), 25, 48, 180, 20, this, GlobalStyle.textFormatWhite, true);
            this._storageGold = ObjCreate.createGTextField("", 75, 68, 180, 20, this, GlobalStyle.textFormatWhite, true);
            this._storageCoin = ObjCreate.createGTextField("", 165, 68, 180, 20, this, GlobalStyle.textFormatWhite, true);
            var loc3=GlobalClass.getBitmap("Yuanbao");
            ObjCreate.setObjAttri(loc3, 55, 68, -1, -1, this);
            var loc4=GlobalClass.getBitmap("Tongqian");
            ObjCreate.setObjAttri(loc4, 145, 68, -1, -1, this);
            ObjCreate.createBg(20, 86, 223, 2, this, ImagesConst.SplitLine);
            this._memberMumText = ObjCreate.createGTextField(Language.getStringByParam(27962, 0), 25, 92, 180, 20, this, GlobalStyle.textFormat2, true);
            var loc5=GlobalClass.getBitmap("Yuanbao");
            ObjCreate.setObjAttri(loc5, 45, 115, -1, -1, this);
            var loc6=GlobalClass.getBitmap("Tongqian");
            ObjCreate.setObjAttri(loc6, 45, 140, -1, -1, this);
            this._goldInput = ObjCreate.createGTextInput(70, 114, 80, 20, this);
            this._goldInput.restrict = "0-9";
            this._goldInput.maxChars = 8;
            this._goldInput.text = "0";
            this._goldInput.addEventListener(flash.events.Event.CHANGE, this.onMoneyChangeHandler);
            this._coinInput = ObjCreate.createGTextInput(70, 140, 80, 20, this);
            this._coinInput.restrict = "0-9";
            this._coinInput.maxChars = 8;
            this._coinInput.text = "0";
            this._coinInput.addEventListener(flash.events.Event.CHANGE, this.onCoinChangeHandler);
            ObjCreate.createBg(20, 165, 223, 2, this, ImagesConst.SplitLine);
            var loc7;
            (loc7 = ObjCreate.createGButton(Language.getString(52012), 160, 132, 72, 28, this)).addEventListener(flash.events.MouseEvent.CLICK, this.onOkBtnClickHandler);
            var loc8=ObjCreate.createGTextField(Language.getString(27972), 25, 172, 180, 20, this, GlobalStyle.textFormat2);
            var loc9=GlobalClass.getBitmap("Yuanbao");
            ObjCreate.setObjAttri(loc9, 55, 195, -1, -1, this);
            var loc10=GlobalClass.getBitmap("Tongqian");
            ObjCreate.setObjAttri(loc10, 145, 195, -1, -1, this);
            this._expendGold = ObjCreate.createGTextField("0", 75, 195, 180, 20, this, GlobalStyle.textFormatWhite, true);
            this._expendCoin = ObjCreate.createGTextField("0", 165, 195, 180, 20, this, GlobalStyle.textFormatWhite, true);
            return;
        }

        /* internal */ /* var */_storageGold: GTextFiled;

        /* internal */ /* var */_storageCoin: GTextFiled;

        /* internal */ /* var */_goldInput: GTextInput;

        /* internal */ /* var */_coinInput: GTextInput;

        /* internal */ /* var */_expendGold: GTextFiled;

        /* internal */ /* var */_expendCoin: GTextFiled;

        /* internal */ /* var */_memberMumText: GTextFiled;

        /* internal */ /* var */_memberSum: int;

        /* internal */ /* var */_responFun: Function;
    }
